//*****************************************************************
// TransformThread.cpp
//
//  Created on: Jan 21, 2012
//      Author: Christopher Wood
//              Robert Livosi
//
//  $Id: TransformThread.cpp 23 2012-01-28 02:51:05Z caw4567@gmail.com $
//*****************************************************************

#include "TransformThread.h"

/**
 * Create a new transform thread with the specified I/O group.
 *
 * @param ioGroup - analog I/O thread object.
 */
TransformThread::TransformThread(IOThreadGroup* ioGroup)
{
	this->ioGroup = ioGroup;
}

/**
 * Default destructor.
 */
TransformThread::~TransformThread()
{
}

/**
 * Retrieve the I/O thread group associated with this transform object.
 *
 * @return a pointer to the I/O thread group.
 */
IOThreadGroup* TransformThread::getSignalGroup()
{
	return ioGroup;
}

/**
 * Retrieve the transform execution semaphore used to trigger a conversion.
 *
 * @return a pointer to the transform semaphore.
 */
sem_t* TransformThread::getTransformSem()
{
	return &transformSem;
}

/**
 * Set the thread state of this transform thread.
 *
 * @param alive - boolean flag indicating the alive state of this thread.
 */
void TransformThread::setThreadState(bool alive)
{
	this->alive = alive;
}

/**
 * Release this thread from its semaphore.
 */
void TransformThread::release()
{
	sem_post(&transformSem);
}

/**
 * Determine if this thread is still alive (or should still be alive)
 *
 * @return true if still alive, false otherwise.
 */
bool TransformThread::isAlive()
{
	return alive;
}
